<template>
  <div class="details">
    <div class="title">{{ info.title }}</div>
    <div class="time-and-views">
      <div class="time">
        <img src="~/assets/images/time.png" alt="" />
        时间：{{ info.create_time || '--' }}
      </div>
      <div class="views">
        <img src="~/assets/images/read.png" alt="" />
        {{ info.visit || 0 }}人已读
      </div>
    </div>
    <div class="_content" v-html="info.content || '正在完善中...'"></div>
    <div class="pagination">
      <div class="prev transition">上一篇：xxxxxxxxx</div>
      <div class="next transition">下一篇：asdfkljasdf</div>
    </div>
  </div>
</template>

<script>
import { getNewsDeMer } from "@/request/api";
export default {
  name: "news-details",
  data() {
    return {
      info: {},
    };
  },
  created() {
    this.getInfo()
  },
  methods: {
    getInfo() {
    const id = this.$route.params.id
    const mer_id = this.$route.params.id
    const data = {
      id: id,
      mer_id: mer_id
    }
    getNewsDeMer(data).then((res) => {
        this.info = res.data
        // todo
        console.log('newInfo',res);
      }).catch((err) => {
        this.$message.error(err.message)
      })
    }
  }
}
</script>

<style lang="scss" scoped>
@import "~@/assets/style/common.scss";

.details {
  padding: 30px 0;
  background-color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;

  .title {
    font-size: 20px;
    color: #666;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
  }

  .time-and-views {
    display: flex;
    justify-content: center;
    color: #969696;
    font-size: 14px;
    margin-bottom: 50px;

    .time,
    .views {
      display: flex;
      align-items: center;

      &.time {
        margin-right: 30px;
      }

      img {
        margin-right: 5px;
      }
    }
  }

  ._content {
    width: 90%;
    font-size: 16px;
    color: #666;
    padding: 45px 50px;
    border-top: solid 1px #eaeaea;
    border-bottom: solid 1px #eaeaea;
    margin-bottom: 30px;
  }

  .pagination {
    width: 90%;

    .prev,
    .next {
      color: #666;
      font-size: 16px;
      cursor: pointer;

      &:hover {
        color: $theme-color-1;
      }
    }

    .prev {
      margin-bottom: 15px;
    }
  }
}
</style>
